package com.cgwx.commonutils.math.function;

/**
 * @author GaoWei
 * @Date 2021/8/6 - 9:45
 */
public class AcoshFunction implements Function
{
    @Override
    public double of(double[] d, int numParam)
    {
        double a = Math.sqrt((d[0] + 1.0D) / 2.0D);
        double b = Math.sqrt((d[0] - 1.0D) / 2.0D);
        return 2.0D * Math.log(a + b);
    }

    @Override
    public boolean acceptNumParam(int numParam)
    {
        return numParam == 1;
    }

    public String toString()
    {
        return "acosh(x)";
    }
}
